package com.itheima.reggie.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Project Name: reggie_take_out
 * File Name: LoginCherckFilter
 *
 * @version 1.0
 * @author:wenerduo
 * @Date: 2022/07/16/上午 11:06
 * Copyright (c) 2022,
 */
/*检查用户是否已经完成登录*/
    @WebFilter(filterName = "loginCheckFilter",urlPatterns = "/*")
    @Slf4j
public class LoginCherckFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request=(HttpServletRequest) servletRequest;
        HttpServletResponse response=(HttpServletResponse) servletResponse;
        log.info("拦截到请求：{}",request.getRequestURI());
        filterChain.doFilter(request,response);
        String requestURI=request.getRequestURI();
      //定义不需要处理的请求路径
        String[] urls=new String[]{
                "/employee/login",
                "/employee/logout",
                "backend/**",
                "/front/**"
        };
    }
}
